<template>
  <div class="shoucang">
    <!-- 头部 -->
    <van-nav-bar
      title="收藏"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- 滑动单元格------------------------------------------------------------------ -->
      <!-- 没有手藏东西的时候 -->
      <div v-if=" $store.state.scj == 0">
        <van-empty description="还没有你喜欢的哦" />
      </div>
     <van-swipe-cell  v-for="(item,i) of $store.state.scj" :key="i">
      <!-- 卡片card -->
      <van-card
        tag="推荐"
        :desc="item.tag"
        :title="item.name"
        :thumb="item.pic"
      >
        <!-- 卡片标签 -->
        <template #tags>
          <van-tag plain type="danger">好吃</van-tag>
          <van-tag plain type="danger">好玩</van-tag>
          <van-tag plain type="danger">好喝</van-tag>
          <van-tag plain type="danger">开心起来</van-tag>
        </template>
      </van-card>
      <!-- 卡片右边的删除键 -->
      <template #right>
        <van-button square text="删除" type="danger" class="delete-button" @click="scsc(item)" />
      </template>
    </van-swipe-cell>
  
    
  
  </div>
</template>
<script>
export default {
  data() {
    return {
      //  sy:[{ tp:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn%2Fupload%2F2020%2F04%2F25%2F3adc968cd0a34c1d87bfea6d83e386e0_w300X225_w196X147.jpg%3FimageView2%2F2%2Fw%2F800&refer=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629042941&t=51c28a8408917870c840d7686ba78b55',
      // bt:'小米粥',
      // btx:'不一样的生活',
      // tj:['推荐','好吃','好玩','好喝','好开心'],},
      // {
      // tp:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn%2Fupload%2F2020%2F04%2F25%2F3adc968cd0a34c1d87bfea6d83e386e0_w300X225_w196X147.jpg%3FimageView2%2F2%2Fw%2F800&refer=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629042941&t=51c28a8408917870c840d7686ba78b55',
      // bt:'南瓜粥',
      // btx:'不一样的生活',
      // tj:['推荐','好吃','好玩','好喝','好开心'],
      // },{
      // tp:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn%2Fupload%2F2020%2F04%2F25%2F3adc968cd0a34c1d87bfea6d83e386e0_w300X225_w196X147.jpg%3FimageView2%2F2%2Fw%2F800&refer=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629042941&t=51c28a8408917870c840d7686ba78b55',
      // bt:'土豆粥',
      // btx:'不一样的生活',
      // tj:['推荐','好吃','好玩','好喝','好开心'],
      // },
      // { tp:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn%2Fupload%2F2020%2F04%2F25%2F3adc968cd0a34c1d87bfea6d83e386e0_w300X225_w196X147.jpg%3FimageView2%2F2%2Fw%2F800&refer=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629042941&t=51c28a8408917870c840d7686ba78b55',
      // bt:'小米粥',
      // btx:'不一样的生活',
      // tj:['推荐','好吃','好玩','好喝','好开心'],},
      //  { tp:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn%2Fupload%2F2020%2F04%2F25%2F3adc968cd0a34c1d87bfea6d83e386e0_w300X225_w196X147.jpg%3FimageView2%2F2%2Fw%2F800&refer=http%3A%2F%2Fimage-qzone.mamaquan.mama.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629042941&t=51c28a8408917870c840d7686ba78b55',
      // bt:'小米粥',
      // btx:'不一样的生活',
      // tj:['推荐','好吃','好玩','好喝','好开心'],},
      // ]
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    //删除收藏
    scsc(item){
      this.$store.state.scj.splice(item,1)
    }
  },
};
</script>
<style>
.shoucang .goods-card {
  margin: 0;
  background-color: white;
}

.shoucang .delete-button {
  height: 100%;
}
</style>